﻿using DbMapper.service;
using DbMapper.viewmodel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using System.Data.SqlClient;
using DbMapper.model;

namespace DbMapper.controller
{
    class MainWindowController
    {
        public DbMapperService mapperService = new DbMapperService();
        public MainWindowViewModel mainWindowViewModel { get; set; } = new MainWindowViewModel();

        public void ConnecteDatabase(DbInfo dbInfo)
        {

            mapperService.ConnecteDatabase(dbInfo);
        }

        public DataTable GetFieldDataTable(string sourceTable, string sourceField)
        {
            return mapperService.GetFieldDataTable(sourceTable, sourceField);
        }

        #region //根据表明获取表中所有数据
        public DataTable GetFieldDataTable(string sourceTable)
        {
            return mapperService.GetFieldDataTable(sourceTable);
        }
        #endregion

        public object InsertDate(string Table, string Field, DataTable dt)
        {
            return mapperService.InsertDate(Table, Field, dt);
        }


    }
}
